class CQPossibleAnswer < ActiveRecord::Base
	include AliasingColumns
        
  	set_table_name "CQ_POSSIBLE_ANSWERS"
	AliasingColumns.add_aliases columns
		
	belongs_to :closedquestion,
			   :class_name => "ClosedQuestion",
			   :foreign_key => "closed_question_id"
	
	has_many :cqanswers,
			 :class_name => "CQAnswer",
			 :foreign_key => "possible_answer_id",	   
			 :dependent => :destroy
	validates_presence_of :possible_answer
		 
		
	if  AliasingColumns.get_adapter_name == "oracle"
#		self.primary_key ="ID"
		set_sequence_name table_name()<<"_SEQ" 
	#	before_create :set_id
		def set_id
			 self.ID =connection.next_sequence_value(self.class.sequence_name)	
		end 
	end
	
end
